import {createRouter, createWebHistory,RouteRecordRaw} from 'vue-router';

//引入路由 创建数组，用于保存一个组件对应路由地址
const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: 'HelloWorld',
        component: () => import('../components/HelloWorld.vue')
    },
    {
        path: '/Father',
        name: 'Father',
        component: () => import('../view/Father.vue')
    },
    {
        path: '/Son',
        name: 'Son',
        component: () => import('../view/Son.vue')
    },
]

//获取路由实例 createRouter() 创建路由函数 createWebHistory() 创建路由历史记录函数
const router = createRouter({
    history: createWebHistory(),
    routes
   
})
//导出路由实例
export default router;